<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/html">

<head>
    <meta charset="UTF-8">
    <title>管理员列表</title>
    <link href="__PUBLIC__/layui/css/layui.css" rel="stylesheet" />
    <link rel="stylesheet" href="__PUBLIC__/css/global.css" media="all">
    <link href="__PUBLIC__/Font-Awesome/css/font-awesome.css" rel="stylesheet" />
</head>

<body>
<div class="admin-main">
   <!-- <blockquote class="layui-elem-quote">
        <form  class="layui-form" action="">
            <div class="custom-form-item">
                <label class="layui-form-label">邮箱：</label>
                <div class="layui-input-inline">
                    <input type="text" class="layui-input" value="<?php echo !empty($map['user_moblie']) ?$map['user_moblie'] :'' ?>" id="user_moblie" maxlength="16" name="user_moblie" placeholder="支持模糊搜索" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"/>
                </div>
            </div>
            <div class="custom-form-item">
                <label class="layui-form-label">团队名称：</label>
                <div class="layui-input-inline">
                    <input type="text" class="layui-input" value="<?php echo !empty($map['enter_name']) ?$map['enter_name'] :'' ?>" maxlength="50" id="enter_name" name="enter_name" placeholder="请输入团队名称"/>
                </div>
            </div>
            <div class="custom-form-item">
                <button class="layui-btn search" lay-submit lay-filter="search">搜索</button>
            </div>
            <div class="layui-clear"></div>
        </form>
    </blockquote>-->
    <blockquote class="layui-elem-quote">
        <button  class="layui-btn layui-btn-small add">
            <i class="layui-icon">&#xe608;</i> 创建团队
        </button>
    </blockquote>
    <fieldset class="layui-elem-field">
        <legend>管理员列表</legend>
        <div class="layui-field-box">
            <table class="layui-table">
                <thead>
                <tr>
                    <th>邮箱</th>
                    <th>别名</th>
                    <th>状态</th>
                    <th>团队名称</th>
                    <th>最后登录时间</th>
                    <th>最后登录IP</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody id="listcontent">
                </tbody>
            </table>
        </div>
    </fieldset>
    <div class="admin-table-page">
        <div id="page" class="page">
        </div>
    </div>
</div>
<script id="listtpl" type="text/html">
    <tr>
        <td>{{d.email}}</td>
        <td>{{d.name}}</td>
        <td>
            {{# if(d.is_status == 1){ }} <span>活跃状态</span> {{# }else if(d.is_status == 2){ }} <span>关闭状态</span> {{# } }}
        </td>
        <td>{{ d.teamName}}</td>
      <td>{{# if(d.times != null){ }}<span>{{d.times}}</span> {{# }else{ }} <span>未知</span> {{# } }}</td>
        <td>{{# if(d.ip != null){ }}<span>{{d.ip}}</span> {{# }else{ }} <span>未知</span> {{# } }}</td>
        <td>

            <a data="{{d.id}}" class="layui-btn layui-btn-mini layui-btn-normal edit"><i class="layui-icon">&#xe642;</i>编辑</a>
           <!-- <a  data="{{d.u_id}}" class="layui-btn layui-btn-danger layui-btn-mini del"><i class="layui-icon">&#xe640;</i>删除</a>-->
        </td>
    </tr>
</script>
<script type="text/javascript" src="__PUBLIC__/layui/layui.js"></script>
<script>
    var form,layer,$;
    layui.use(['layer', 'form','laypage','laytpl'], function () {
        var laypage = layui.laypage,laytpl = layui.laytpl;
        form = layui.form();
        $ = layui.jquery
        layer=layui.layer;
        var pagelistdate;
        var curr;

        laypage({
            cont: 'page',
            pages: {$page} //总页数
            ,
            groups: 5 //连续显示分页数
            ,
            jump: function(obj, first) {
                curr = obj.curr;
                listcontent.innerHTML='';
                $.ajax({
                    type: "GET",
                    url: "",
                    data: {
                        p:curr
                    },
                    async: false,
                    success: function(date){
                        if(date.code==101){
                            layui.each(date.data,function(k,v){
                                var getTpl = listtpl.innerHTML;
                                laytpl(getTpl).render(v, function(html){
                                    listcontent.innerHTML += html;
                                });
                            });
                        }
                    }
                });
                caozuo();
            }
        });

        $('.add').click(function(){
            var url = "{:U('Team/add')}";
            $.get(url,function(data){
                if(data.status == 'error'){
                    layer.msg(data.msg,{icon: 5});
                    return;
                }
                layer.open({
                    title:'创建团队',
                    type: 1,
                    skin: 'layui-layer-rim',
                    area: ['500px'],
                    content: data
                });
            });
        });

        function caozuo(){
            $('.edit').click(function () {
                var id = $(this).attr('data');
                var url = "{:U('Team/add')}";
                $.get(url, {id: id}, function (data) {
                    if (data.status == 'error') {
                        layer.msg(data.msg, {icon: 5});
                    }
                    layer.open({
                        title: '编辑管理员信息',
                        type: 1,
                        skin: 'layui-layer-rim',
                        area: ['500px', '500px;'],
                        content: data,
                    });
                });
            });
            /*$('.del').click(function () {
                var id = $(this).attr('data');
                var url = "{:U('MemberUser/del')}";
                layer.confirm('删除后数据无法还原，确定删除吗？', {
                    icon: 3,
                    skin: 'layer-ext-moon',
                    btn: ['确认','取消']
                }, function(){
                    $.post(url,{id:id},function(data){
                        if(data.status=='error'){
                            layer.msg(data.msg,{icon: 5});
                        }else{
                            layer.msg(data.msg, {
                                icon: 6,
                                time: 2000
                            }, function(){
                                window.location.reload();
                            });
                        }
                    });
                });
            });*/
            $('.log').click(function () {
                var user_id = $(this).attr('data');
                var url = "{:U('DealerMember/giveLog')}";
                $.get(url,{user_id:user_id},function(data){
                    if(data.status == 'error'){
                        layer.msg(data.msg,{icon: 5});
                    }

                    layer.open({
                        title:'登陆日志',
                        type: 1,
                        skin: 'layui-layer-rim',
                        area: ['500px','500px'],
                        content: data,
                    });
                });
            });




        }
    });
</script>
</body>

</html>